home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
476-500
/
disk_480
/
tpledit
/
src
/
test.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-06
|
2KB
|
100 lines
/*
* TEST.C
*
* TEST GADGET COMPILATION
*
* WARNING WARNING. Non DICE C users must open appropriate libraries
* (actually, even DICE users will have to, I just added some of the
* libraries that need openning to the auto-open library)
*/
#include "x.tpl.c"
#include <clib/intuition_protos.h>
main()
{
struct Screen *scr;
struct Window *win;
struct Gadget *glist;
if (scr = LockPubScreen(NULL)) {
if (glist = InitGads(scr)) {
win = OpenWindowTags(NULL,
WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|
WFLG_SIZEGADGET|WFLG_SMART_REFRESH|WFLG_ACTIVATE,
WA_IDCMP, IDCMP_NEWSIZE|IDCMP_MOUSEBUTTONS|IDCMP_GADGETDOWN|
IDCMP_GADGETUP|IDCMP_MENUPICK|IDCMP_VANILLAKEY|
IDCMP_RAWKEY|IDCMP_CHANGEWINDOW|IDCMP_CLOSEWINDOW|
IDCMP_REFRESHWINDOW,
WA_Left, WIN_LEFT,
WA_Top, WIN_TOP,
WA_Width, WIN_WIDTH,
WA_Height, WIN_HEIGHT,
WA_Title, "TEST",
WA_MinWidth, 32,
WA_MinHeight, 32,
WA_MaxWidth, -1,
WA_MaxHeight, -1,
WA_AutoAdjust, 1,
WA_PubScreen, NULL,
WA_PubScreenFallBack, 1,
WA_Gadgets, glist,
TAG_END
);
if (win) {
struct IntuiMessage *im;
short notDone = 1;
GT_RefreshWindow(win, NULL);
while (notDone) {
WaitPort(win->UserPort);
while (im = GT_GetIMsg(win->UserPort)) {
switch(im->Class) {
case IDCMP_CLOSEWINDOW:
notDone = 0;
break;
case IDCMP_REFRESHWINDOW:
GT_BeginRefresh(win);
GT_EndRefresh(win, TRUE);
break;
case IDCMP_GADGETUP:
switch(((struct Gadget *)im->IAddress)->GadgetID) {
case GAD_B1:
puts("BUTTON 1");
break;
case GAD_B2:
puts("BUTTON 2");
break;
case GAD_B3:
printf("String L3: %s\n", Buf_B3);
break;
case GAD_B4:
printf("String L4: %s\n", Buf_B4);
break;
case GAD_r1:
printf("hello %d\n", im->Code);
break;
case GAD_S1:
printf("SEL %d\n", im->Code);
break;
}
break;
default:
break;
}
GT_ReplyIMsg(im);
}
}
CloseWindow(win);
}
}
FreeGads();
}
return(0);
}